using System;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace RiceShop.Models
{
    /// <summary>
    /// 商品SPU实体类
    /// </summary>
    [Table("Good")]
    public class Good
    {
        /// <summary>
        /// 商品SPU ID
        /// </summary>
        [Key]
        [Column("spuId")]
        public long SpuId { get; set; }

        /// <summary>
        /// 商品编号
        /// </summary>
        [Column("spuNo")]
        [StringLength(50)]
        public string? SpuNo { get; set; }

        /// <summary>
        /// SAAS ID
        /// </summary>
        [Column("saasId")]
        public long? SaasId { get; set; }

        /// <summary>
        /// 店铺ID
        /// </summary>
        [Column("storeId")]
        public long? StoreId { get; set; }

        /// <summary>
        /// 分类ID
        /// </summary>
        [Column("cateId")]
        public long? CateId { get; set; }

        /// <summary>
        /// 品牌ID
        /// </summary>
        [Column("brandId")]
        public long? BrandId { get; set; }

        /// <summary>
        /// 商品标题
        /// </summary>
        [Column("title")]
        [StringLength(255)]
        public string? Title { get; set; }

        /// <summary>
        /// 商品简介
        /// </summary>
        [Column("brief")]
        public string? Brief { get; set; }

        /// <summary>
        /// 主图
        /// </summary>
        [Column("primaryImage")]
        [StringLength(500)]
        public string? PrimaryImage { get; set; }

        /// <summary>
        /// 图片集
        /// </summary>
        [Column("images")]
        public string? Images { get; set; }

        /// <summary>
        /// 视频
        /// </summary>
        [Column("video")]
        public string? Video { get; set; }

        /// <summary>
        /// 配送方式
        /// </summary>
        [Column("productsDistributionType")]
        public int? ProductsDistributionType { get; set; }

        /// <summary>
        /// SKU ID列表
        /// </summary>
        [Column("skuIds")]
        public string? SkuIds { get; set; }

        /// <summary>
        /// 规格描述
        /// </summary>
        [Column("spesDesc")]
        public string? SpesDesc { get; set; }

        /// <summary>
        /// 参数
        /// </summary>
        [Column("parameters")]
        public string? Parameters { get; set; }

        /// <summary>
        /// 参数ID列表
        /// </summary>
        [Column("paramsIds")]
        public string? ParamsIds { get; set; }

        /// <summary>
        /// 是否为普通虚拟商品
        /// </summary>
        [Column("IsNomalVirtual")]
        public bool? IsNomalVirtual { get; set; }

        /// <summary>
        /// 商品状态
        /// </summary>
        [Column("status")]
        public byte? Status { get; set; }

        /// <summary>
        /// 单位
        /// </summary>
        [Column("unit")]
        [StringLength(50)]
        public string? Unit { get; set; }

        /// <summary>
        /// 商品描述
        /// </summary>
        [Column("description")]
        public string? Description { get; set; }

        /// <summary>
        /// 商品微信描述
        /// </summary>
        [Column("desc")]
        public string? Desc { get; set; }

        /// <summary>
        /// 商品标签列表
        /// </summary>
        [Column("spuTagList")]
        public string? SpuTagList { get; set; }

        /// <summary>
        /// 评论数
        /// </summary>
        [Column("commentsCount")]
        public int? CommentsCount { get; set; }

        /// <summary>
        /// 浏览数
        /// </summary>
        [Column("viewCount")]
        public int? ViewCount { get; set; }

        /// <summary>
        /// SPU库存数量
        /// </summary>
        [Column("spuStockQuantity")]
        public int? SpuStockQuantity { get; set; }

        /// <summary>
        /// 已售数量
        /// </summary>
        [Column("soldQuantity")]
        public int? SoldQuantity { get; set; }

        /// <summary>
        /// 上架时间
        /// </summary>
        [Column("uptime")]
        public DateTime? Uptime { get; set; }

        /// <summary>
        /// 下架时间
        /// </summary>
        [Column("downtime")]
        public DateTime? Downtime { get; set; }

        /// <summary>
        /// 排序
        /// </summary>
        [Column("sort")]
        public int? Sort { get; set; }

        /// <summary>
        /// 标签ID列表
        /// </summary>
        [Column("labelIds")]
        public string? LabelIds { get; set; }

        /// <summary>
        /// 新规格
        /// </summary>
        [Column("newSpec")]
        public string? NewSpec { get; set; }

        /// <summary>
        /// 开放规格
        /// </summary>
        [Column("openSpec")]
        public int? OpenSpec { get; set; }

        /// <summary>
        /// 是否推荐
        /// </summary>
        [Column("isRecommend")]
        public bool? IsRecommend { get; set; }

        /// <summary>
        /// 是否热门
        /// </summary>
        [Column("isHot")]
        public bool? IsHot { get; set; }

        /// <summary>
        /// 销售价
        /// </summary>
        [Column("salePrice", TypeName = "decimal(18,2)")]
        public decimal? SalePrice { get; set; }


        /// <summary>
        /// 划线价
        /// </summary>
        [Column("linePrice", TypeName = "decimal(18,2)")]
        public decimal? LinePrice { get; set; }


        /// <summary>
        /// 创建时间
        /// </summary>
        [Column("createTime")]
        public DateTime? CreateTime { get; set; }

        /// <summary>
        /// 更新时间
        /// </summary>
        [Column("updateTime")]
        public DateTime? UpdateTime { get; set; }

        /// <summary>
        /// 是否删除
        /// </summary>
        [Column("isDeleted")]
        public bool? IsDeleted { get; set; }


        /// <summary>
        /// 商品规格实体类
        /// </summary>
        public List<Spec> Specs { get; set; } = new();

        /// <summary>
        /// 商品标签实体类
        /// </summary>
        public List<SpecValue> SpecValues { get; set; } = new();

        /// <summary>
        /// 商品SKU实体类
        /// </summary>
        public List<SKU> Skus { get; set; } = new();


    }

    [Table("Spec")]
    public class Spec
    {
        [Key] // 指定为主键
        [Column("specId")]
        [MaxLength(50)] // 指定最大长度为50
        public string? SpecId { get; set; }

        [Required] // 指定字段为必填
        [Column("specName")]
        [MaxLength(64)] // 指定最大长度为64
        public string? SpecName { get; set; }

        [Column("spuId")]
        public long SpuId { get; set; }


    }

    /// <summary>
    /// Represents a SpecValue entity in the database.
    /// </summary>
    [Table("SpecValue")] // 指定表名
    public class SpecValue
    {
        [Key] // 指定为主键
        [Column("valueId")]
        [MaxLength(50)] // 指定最大长度为50
        public string? ValueId { get; set; }

        [Column("specId")]
        [MaxLength(50)] // 指定最大长度为50
        public string? SpecId { get; set; }

        [Column("spuId")]
        public long SpuId { get; set; }

        [Required] // 指定字段为必填
        [MaxLength(64)] // 指定最大长度为64
        [Column("valueName")]
        public string? ValueName { get; set; }


    }
}